External objects are a key extensibility pattern for Adobe applications that integrate ExtendScript. You might want to use them to call into your own existing platform-native libraries or exploit the ability to call into C/C++ code of your own from a scripting context.
Once you have successfully compiled and tested the sample code with the provided sample scripts, you should be aware of the recommended deployment pattern for these extensions like your External Object library, which is effectively a plug-in. If you change the location of the libraries to this location, be sure to change the paths in JavaScript files that load the libraries accordingly.
The recommended location for extensions is different for each application so check their Programmer's Guide.
var myObj = new ExternalObject ("lib:" + libName);
The constructor can take an arbitrary number of arguments, which are passed on to the library's initialization routine:
myObj = new ExternalObject ("lib:" + libName, arg1, arg2);
The specifier "lib:" is case sensitive. The library name can be the base name of the shared library as well as include the path to the library: Note: the ExternalObject architecture in future may be extended to wrap other types of external data; at present "lib:" is the marker for dynamically linked libraries.
var libName = "C:\myLibraries\myLib.dll"; var myObj = new ExternalObject ("lib:" + libName);
If the loader cannot load the library by its given name, it appends a file extension according to the operating system:
Folder.current = File ($.fileName).parent; var myLib = new ExternalObject("lib:Plugins/myLib.dll");
To unload a library, call the object's unload() method. This method unloads the library and leaves the object in an invalid state. Any attempts to access properties or methods of the library object once unloaded result in a runtime error.
myLib.unload();
See Using the Sample Projects for information on how to find the sample projects
See Using the BasicExternalObject Sample for information on how to build the External Object sample
See Using the SampleLib Example for information on how to build the Sample Lib sample.

![]()
Copyright© 2008 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks